
module.exports = function ($scope, $stateParams, $http, $q,what,productid,str2date, date2str, $resource, toaster, $modalInstance, auditing, FileUploader) {
	
		var id = $stateParams.id || productid;
		var type = $stateParams.type;
		var code = $stateParams.code;
		console.log(productid);
		console.log(type);
		console.log(what);
		//产品对象，保存着产品的基本信息
		$scope.placeobj = {
			'id': id || '',
			'type' : type || '',
			'code' : code || ''
		};
		// console.log('编辑' + $scope.placeobj.type, $scope.placeobj.id, $scope.placeobj.code);
		$scope.util = {
			'what': what,
			'str2date': str2date,
			'date2str': date2str,
			'$modalInstance': $modalInstance,
			'auditing': auditing
		}
		//销售品功能列表
		$scope.funobj = {};
	
		//基本信息中需要提前弄好的信息。
		$scope.baseinfo = {
			'imageshow': {},
			'dateshow': {},
		};
		var uploader1 = $scope.uploader1 = new FileUploader({
			url: 'https://txy.juyouhx.com/Api/Api/ObjectToOss?topdir=aa&selfdir=bb'
		});
		uploader1.filters.push({
			name: 'imageFilter',
			fn: function (item /*{File|FileLikeObject}*/, options) {
				var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
				return '|jpg|png|jpeg|bmp|gif|'.indexOf(type) !== -1;
			}
		});
		uploader1.onSuccessItem = function (fileItem, response, status, headers) {
			$scope.placeobj.img = response.savename;
		};
	
		var uploader2 = $scope.uploader2 = new FileUploader({
			url: 'https://txy.juyouhx.com/Api/Api/ObjectToOss?topdir=aa&selfdir=bb'
		});
		uploader2.filters.push({
			name: 'imageFilter',
			fn: function (item /*{File|FileLikeObject}*/, options) {
				var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
				return '|jpg|png|jpeg|bmp|gif|'.indexOf(type) !== -1;
			}
		});
		uploader2.onSuccessItem = function (fileItem, response, status, headers) {
			$scope.placeobj.logo = response.savename;
		};
	
		$scope.baseinfo.imageshow.img = uploader1;
		$scope.baseinfo.imageshow.logo = uploader2;
	
		
	
		
	
	
	
	};